{template 'common/header'}

<div id="menu">
    <ul class="nav nav-tabs">
        <li {if $_GPC['action'] == ''}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('ptrecord', array('action' => ''));}">平台总览</a>
        </li>
        <li {if $_GPC['action'] == 'mx'}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('ptrecord', array('action' => 'mx'));}">营利明细</a>
        </li>
        <li {if $_GPC['action'] == 'list'}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('ptrecord', array('action' => 'list'));}">赞助列表</a>
        </li>
        <li {if $_GPC['action'] == 'add'}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('ptrecord', array('action' => 'add'));}">修改/添加</a>
        </li>
    </ul>
</div>



{if $_GPC['action'] ==''}
<table class="table table-hover">
    <thead class="navbar-inner">
    <tr>
        <th>公众号</th>
        <th>收益</th>
        <th>支出</th>
        <th>营利</th>
        <th>更新时间</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>{$uniacid}</td>
        <td>{$shouyi1}</td>
        <td>{$zhichu1}</td>
        <td>{php echo $shouyi1-$zhichu1 }</td>
        <td>{php echo date('Y-m-d H:i',time())}</td>
    </tr>
    </tbody>
</table>
{/if}
{if $_GPC['action'] =='mx'}
<table class="table table-hover">
    <thead class="navbar-inner">
    <tr>
        <th>类型</th>
        <th>金额</th>
        <th>说明</th>
        <th>时间</th>
    </tr>
    </thead>
    <tbody>
    {loop $zong $v}
    <tr>
        {if $v['state'] ==0}
        <td>收益</td>
        {else}
        <td>支出</td>
        {/if}
        <td>{$v['money']}</td>
        <td>{$v['demo']}</td>
        <td>{$v['date']}</td>
    </tr>
    {/loop}
    </tbody>
</table>
<div class="col-xs-12">
    {php echo $pager}
</div>
{/if}

{if $_GPC['action'] == 'add'}
<form method="post" action="{php echo $this->createWebUrl('ptrecord',array('action'=>'add','id'=>$res['id']))}" class="form-horizontal bv-form" role="form" novalidate="novalidate">
    <div class="panel panel-info">
        <div class="panel-heading">广告列表</div>
        <div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">选择日期</label>
                <div class="col-sm-9 col-md-8 col-lg-8 col-xs-12">
                    <input type="text" name="date" value="{$date}" placeholder="请选择日期时间" readonly="readonly" class="datetimepicker form-control" >
                    <script type="text/javascript">
                        require(["datetimepicker"], function(){
                            var option = {
                                lang : "zh",
                                step : 5,
                                timepicker : false,
                                closeOnDateSelect : true,
                                format : "Y-m-d"
                            };
                            $(".datetimepicker[name = 'date']").datetimepicker(option);
                        });
                    </script>
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label" >金额</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="number" name="money" value="{$res['money']}" class="form-control" placeholder="赞助金额">

                </div>
            </div>
        </div>
        <div class="form-group" style="margin-left: 10%;">
            <div class="col-sm-9 col-xs-12">
                <input type="submit" value="提交" class="btn btn-primary">
            </div>
        </div>
    </div>
</form>
{/if}

{if $_GPC['action'] =='list'}
<table class="table table-hover">
    <thead class="navbar-inner">
    <tr>
        <th>金额</th>
        <th>时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $res $v}
    <tr>
        <td>{$v['money']}</td>
        <td>{$v['date']}</td>
        <td>
            <a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('ptrecord',array('action'=>'add', 'id' => $v['id']));}">编辑</a>
            <a class="btn btn-danger btn-sm" href="{php echo $this->createWebUrl('ptrecord',array('action'=>'delete', 'id' => $v['id']));}">删除</a>
        </td>
    </tr>
    {/loop}
    </tbody>
</table>
<div class="col-xs-12">
    {php echo $pager}
</div>
{/if}
{template 'common/footer'}